<?php

namespace App;

use App\Traits\TimeFormat;
use Illuminate\Database\Eloquent\Model;

class Message extends Model {
	use TimeFormat;

	protected $fillable = [
		'content', 'status',
	];
	//
	protected $casts = [
		'status' => 'boolean',
	];

	public static function boot() {
		parent::boot();
	}

	public function user() {
		return $this->belongsTo(User::class);
	}

	public function reply() {
		return $this->belongsTo(User::class, 'reply_id', 'id')->select('id', 'name', 'avatar');
	}
}
